﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OrderGeneratorService
{
   [Serializable]
    public class Order
    {
        protected string Trader;
        protected string ServiceName;
        protected string OrderType;
        protected int NumOfContract;
        public double Price;
        protected int BuySell;

        public Order(string _trader, string _ServiceName, string _OrderType, int _NumOfContract, double _Price, int _BuySell)
        {
            this.Trader = _trader;
            this.ServiceName = _ServiceName;
            this.OrderType = _OrderType;
            this.NumOfContract = _NumOfContract;
            this.Price = _Price;
            this.BuySell = _BuySell;
        }

        public override string ToString()
        {
           string BS;
           if (BuySell == 0)
            BS = "B";
           else 
            BS = "S";
           string print = Trader + " " + ServiceName + " " + OrderType + " " + BS + " " + NumOfContract.ToString() + " " + Price.ToString();
           return print;
        }

        public string[] ToStringArray()
        {
           string[] order = new string[6];
           string BS;
           if (BuySell == 0)
              BS = "B";
           else
              BS = "S";

           order[0] = this.Trader;
           order[1] = this.ServiceName;
           order[2] = this.OrderType;
           order[3] = BS;
           order[4] = this.NumOfContract.ToString();
           order[5] = this.Price.ToString();
           

           return order;
        }
    }
}
